/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.panomedic.kernel;

import com.panomedic.gui.Menu;
import com.panomedic.gui.PhotoPanel;
import com.panomedic.gui.ToolBar;
import com.panomedic.kernel.controllers.MenuController;
import com.panomedic.kernel.controllers.PhotoPanelController;
import com.panomedic.kernel.controllers.ToolBarController;

/**
 *
 * @author Yare
 */
public class ControllerProxy {

    private static ControllerProxy instance = new ControllerProxy();

    public static ControllerProxy getInstance() {
        return instance;
    }

    public ControllerProxy() {

        getMenuController();
        getPhotoPanelController();
        getToolBarController();
    }
    
    private MenuController menuController;
    private PhotoPanelController photoPanelController;
    private ToolBarController toolBarController;

    public MenuController getMenuController() {
        if (menuController == null) {
            Menu menu = VisualHandler.getInstance().getMenu();
            menuController = new MenuController(menu);
        }
        return menuController;
    }

    private PhotoPanelController getPhotoPanelController() {
        if (photoPanelController == null) {
            PhotoPanel photoPanel = VisualHandler.getInstance().getPhotoPanel();
            photoPanelController = new PhotoPanelController(photoPanel);
        }
        return photoPanelController;
    }

    private ToolBarController getToolBarController() {
        if (toolBarController == null) {
            ToolBar toolBar = VisualHandler.getInstance().getToolBar();
            toolBarController = new ToolBarController(toolBar);
        }
        return toolBarController;
    }
}
